package com.dev.security.manager.beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.dev.security.login.beans.LoginSource;

/**
 * 资源信息，属于权限
 * @author 潜行的青衣
 * @see
 */
@Entity
@Table(name = "t_cds_source")
public class Source implements LoginSource {
	
	/**
	 * 用于权限过滤的uri
	 */
	@Id
	@Column(name = "uri", length = 200, unique = true, nullable = false)
	private String uri;
	
	@Column(name = "per_id", length = 50)
	private String per_id;
	
	public Source() {}
	
	public Source(String uri, String per_id) {
		this.uri = uri;
		this.per_id = per_id;
	}

	public String getUri() {
		return uri;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}

	public String getPer_id() {
		return per_id;
	}

	public void setPer_id(String per_id) {
		this.per_id = per_id;
	}

	/* (non-Javadoc)
	 * @see com.dev.security.login.beans.LoginSource#getType()
	 */
	@Transient
	@Override
	public String getType() {
		return this.getPer_id();
	}
}
